﻿using System;
using System.ComponentModel;
using T.FAS.Runtime.Metadata.Entity;
using Newtonsoft.Json;
using T.FAS.Runtime.Base.Entity;

namespace T.FAS.Runtime.Metadata.Entity.DataModel
{
    /// <summary>
    /// 数据库表
    /// </summary>
    [JsonObject(MemberSerialization.OptOut)]
    [Serializable]
    public class MetaDataContent<T> : AbsMetaDataContent
    {        
        public T MetaDataEntity { get; set; }

        public override IRefSchemaEntity BuildRefSchema()
        {
            throw new NotImplementedException();
        }

        public override object Clone()
        {
            Type t = typeof(T);
            if (t.IsSubclassOf(typeof(ICloneable)))
            {
                return (MetaDataEntity as ICloneable).Clone();
            }
            else
                throw new FasException(DataModelErrorCode.Error, $"类型{t}不实现ICloneable接口");
        }
    }
}
